package com.my.lab.service;

import java.util.Timer;
import java.util.TimerTask;

import com.my.lab.PhoneUtils;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

public class WondieService extends Service {
    static String TAG = "WondieService";

    @Override
    public void onCreate() {
        Log.d(TAG, "onCreate is called ...");
        super.onCreate();
    }

    @Override
    public void onStart(Intent intent, int startId) {
        super.onStart(intent, startId);
        PhoneUtils.ListenLog();
        // Timer timer = new Timer();
        // timer.schedule(new TimerTask() {
        //
        // @Override
        // public void run() {
        // // Log.d("WondieService","do something...");
        // }
        // },0,1000*10);
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.d(TAG, "onStartCommand is called ...");
        return super.onStartCommand(intent, Service.START_STICKY, startId);
    }

    @Override
    public void onDestroy() {
        Log.d(TAG, "onDestory is called,restart service...");
        startService(new Intent(getApplicationContext(), WondieService.class));
        super.onDestroy();
    }

    @Override
    public IBinder onBind(Intent intent) {
        Log.d(TAG, "onBind is called...");
        return null;
    }

}
